package cn.rkylin.oms.warehouse.shiporder.vo;

import java.util.List;

import cn.rkylin.oms.common.consts.ShiporderStatus;
import cn.rkylin.oms.common.consts.YesNoConst;
import cn.rkylin.oms.warehouse.shiporder.domain.Shiporder;

/**
 * 发货VO
 * 
 * @author 齐涛
 * @version 1.0
 * @created 28-9-2017 10:51:30
 */
public class ShiporderVO extends Shiporder {

    private static final String STATUS_SKUSHOW = "<span class=\"sku-show fa fa-chevron-down\" shiporderId=\"%s\"></span>";
    private static final String OPERATION_BTN_CANCEL = "<button onclick=\"operationCancel(this)\" shiporderId=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\" pepid='shiporderCancel'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    private static final String OPERATION_BTN_CANCEL_DISABLED = "<button style=\"cursor:dfault\" disabled shiporderId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='shiporderCancel'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    private static final String OPERATION_BTN_CONSIGN = "<button onclick=\"operationConsign(this)\" shiporderId=\"%s\" type=\"button\" class=\"btn btn-success btn-xs\" pepid='shiporderConsign'><i class=\"fa fa-sign-out\"></i>&nbsp;平台发货</button>";
    private static final String OPERATION_BTN_CONSIGN_DISABLED = "<button style=\"cursor:dfault\" disabled shiporderId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='shiporderConsign'><i class=\"fa fa-sign-out\"></i>&nbsp;平台发货</button>";
    private static final String OPERATION_BTN_CANCEL_ORDER = "<button onclick=\"operationCancel(this,\'%s\')\" shiporderId=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\" pepid='shiporderCancelOrder'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    private static final String OPERATION_BTN_CANCEL_ORDER_DISABLED = "<button style=\"cursor:dfault\" disabled shiporderId=\"%s\" type=\"button\" class=\"btn btn-disable btn-xs\" pepid='shiporderCancelOrder'><i class=\"fa fa-times\"></i>&nbsp;取消</button>";
    private int orderSkuNum = 0;

    private String storType ;

    // 基本查询条件
    private String quickSearch;

    // 高级查询条件
    // 付款开始日期
    private String paidDateStart;

    // 付款结束日期
    private String paidDateEnd;

    // 商品编码
    private String goodsCode;

    // 商品名称
    private String goodsName;

    // 规格编码
    private String skuCode;

    // 规格名称
    private String skuName;

    // 发货状态
    private String shiporderStatus;

    // 排序
    private String orderBy;

    // 发货商品信息展开按钮扩展
    private String skuShow;

    // 发货单状态
    private String shipmentsStatus;

    // 操作按钮
    private String operation;

    // 操作按钮
    private String operationOrder;

    // 奇门货主编码
    private String qmOwnercode;

    // 奇门货主Id
    private String qmCustomerid;

    //本地仓库的发货单画面 时间类型
    private String dateType;

    //本地仓库的发货单画面 发货起始
    private String sendDateStart;

    //本地仓库的发货单画面 发货终止
    private String sendDatend;

    public String getStorType() {
        return storType;
    }

    public void setStorType(String storType) {
        this.storType = storType;
    }

    public String getDateType() {
        return dateType;
    }

    public void setDateType(String dateType) {
        this.dateType = dateType;
    }

    public String getSendDateStart() {
        return sendDateStart;
    }

    public void setSendDateStart(String sendDateStart) {
        this.sendDateStart = sendDateStart;
    }

    public String getSendDatend() {
        return sendDatend;
    }

    public void setSendDatend(String sendDatend) {
        this.sendDatend = sendDatend;
    }

    private List<ShiporderSkuVO> shiporderSkuList;

    public List<ShiporderSkuVO> getShiporderSkuList() {
        return shiporderSkuList;
    }

    public void setShiporderSkuList(List<ShiporderSkuVO> shiporderSkuList) {
        this.shiporderSkuList = shiporderSkuList;
    }

    public String getQuickSearch() {
        return quickSearch;
    }

    public void setQuickSearch(String quickSearch) {
        this.quickSearch = quickSearch;
    }

    public String getPaidDateStart() {
        return paidDateStart;
    }

    public void setPaidDateStart(String paidDateStart) {
        this.paidDateStart = paidDateStart;
    }

    public String getPaidDateEnd() {
        return paidDateEnd;
    }

    public void setPaidDateEnd(String paidDateEnd) {
        this.paidDateEnd = paidDateEnd;
    }

    public String getGoodsCode() {
        return goodsCode;
    }

    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getSkuName() {
        return skuName;
    }

    public void setSkuName(String skuName) {
        this.skuName = skuName;
    }

    public String getShiporderStatus() {
        return shiporderStatus;
    }

    public void setShiporderStatus(String shiporderStatus) {
        this.shiporderStatus = shiporderStatus;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getSkuShow() {
        return String.format(STATUS_SKUSHOW, this.getShiporderId()).toString();
    }

    public void setSkuShow(String skuShow) {
        this.skuShow = String.format(STATUS_SKUSHOW, "").toString();
    }

    public String getShipmentsStatus() {
        return shipmentsStatus;
    }

    public void setShipmentsStatus(String shipmentsStatus) {
        this.shipmentsStatus = shipmentsStatus;
    }

    public String getOperationOrder() {
        StringBuffer opButton = new StringBuffer();
        if ("n".equals(this.getShipStatus()) && (!"y".equals(this.getCancelStatus()))) {
            if ("n".equals(this.getHasTaken())) {
                opButton.append(String.format(OPERATION_BTN_CANCEL_ORDER, "waitSendOutGoods", this.getShiporderId()));
            } else {
                opButton.append(String.format(OPERATION_BTN_CANCEL_ORDER, "sendingOutGoods", this.getShiporderId()));
            }
        } else {
            // opButton.append("");
            opButton.append(String.format(OPERATION_BTN_CANCEL_ORDER_DISABLED, this.getShiporderId()));
        }
        operationOrder = opButton.toString();
        return operationOrder;
    }

    public void setOperationOrder(String operationOrder) {
        this.operationOrder = operationOrder;
    }

    public String getOperation() {
        StringBuffer opButton = new StringBuffer();
        if (ShiporderStatus.WAIT_SEND_OUT_GOODS.equals(this.getShiporderStatus())
                || ShiporderStatus.SENDING_OUT_GOODS.equals(this.getShiporderStatus())) { // 待发货，发货中
            if (YesNoConst.NO.equals(this.getLockStatus())) {
                opButton.append(String.format(OPERATION_BTN_CANCEL, this.getShiporderId()));
            } else {
                opButton.append(String.format(OPERATION_BTN_CANCEL_DISABLED, this.getShiporderId()));
            }
        } else if (ShiporderStatus.SHIPED.equals(this.getShiporderStatus())) { // 已系统发货
            if ("or".equals(this.getSourceType())) { // 订单发货
                opButton.append(String.format(OPERATION_BTN_CONSIGN, this.getShiporderId()));
            } else { // 补发发货
                opButton.append(String.format(OPERATION_BTN_CONSIGN_DISABLED, this.getShiporderId()));
            }
        }

        operation = opButton.toString();
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getQmOwnercode() {
        return qmOwnercode;
    }

    public void setQmOwnercode(String qmOwnercode) {
        this.qmOwnercode = qmOwnercode;
    }

    public String getQmCustomerid() {
        return qmCustomerid;
    }

    public void setQmCustomerid(String qmCustomerid) {
        this.qmCustomerid = qmCustomerid;
    }

    public int getOrderSkuNum() {
        return orderSkuNum;
    }

    public void setOrderSkuNum(int orderSkuNum) {
        this.orderSkuNum = orderSkuNum;
    }

}
